From b83719f7dc1e8fc4b5b5dcc6812e2744c3efe344 Mon Sep 17 00:00:00 2001 From: robertl Date: Thu, 3 Feb 2005 21:55:46 +0000 Subject: [PATCH] Add gbtypes.h to (help) solve problem on Alpha. --- gpsbabel/defs.h | 1 + gpsbabel/gbtypes.h | 34 ++++++++++++++++++++++++++++++++++ gpsbabel/saroute.c | 10 +++++----- 3 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 gpsbabel/gbtypes.h diff --git a/gpsbabel/defs.h b/gpsbabel/defs.h index f4d520907..7afd45e80 100644 --- a/gpsbabel/defs.h +++ b/gpsbabel/defs.h @@ -26,6 +26,7 @@ #include #include #include "queue.h" +#include "gbtypes.h" /* diff --git a/gpsbabel/gbtypes.h b/gpsbabel/gbtypes.h new file mode 100644 index 000000000..b8d5b771a --- /dev/null +++ b/gpsbabel/gbtypes.h @@ -0,0 +1,34 @@ +/* + Abstract fixed size data types. + + Copyright (C) 2005 Robert Lipe, robertlipe@usa.net + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA + + */ + +/* + * If this is a problem and any interesting system doesn't have the C99-ism + * of we'll come up with something more clever that'll likely + * include a gross collection of __STDC_VERSION >= 199901L || __GNUC__ + */ + + +#include + +typedef uint32_t gbuint32; +typedef uint16_t gbuint16; +typedef int32_t gbint32; +typedef int16_t gbint16; diff --git a/gpsbabel/saroute.c b/gpsbabel/saroute.c index 4bc5faca8..11dc7f29a 100644 --- a/gpsbabel/saroute.c +++ b/gpsbabel/saroute.c @@ -44,7 +44,7 @@ arglist_t saroute_args[] = { unsigned short ReadShort(FILE * f) { - unsigned short result = 0; + gbuint16 result = 0; fread(&result, sizeof (result), 1, f); return le_read16(&result); @@ -53,7 +53,7 @@ ReadShort(FILE * f) unsigned long ReadLong(FILE * f) { - unsigned long result = 0; + gbuint32 result = 0; fread(&result, sizeof (result), 1, f); return le_read32(&result); @@ -100,8 +100,8 @@ my_read(void) unsigned char *record; static int serial = 0; struct ll { - long lat; - long lon; + gbint32 lat; + gbint32 lon; } *latlon; unsigned short coordcount; route_head *track_head; @@ -250,7 +250,7 @@ my_read(void) } } if ( version > 10 ) { - Skip(infile,2*sizeof(long)); + Skip(infile,2*sizeof(gbuint32)); } xfree(record); } -- 2.30.2